package com.lijun.SpringBootJavaFX;

import com.lijun.SpringBootJavaFX.config.javaFxView.LoginView;
import com.lijun.SpringBootJavaFX.config.splashScreen.CustomSplash;
import de.felixroske.jfxsupport.AbstractJavaFxApplicationSupport;
import javafx.scene.text.Font;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import org.springframework.boot.autoconfigure.SpringBootApplication;


@SpringBootApplication
public class ApplicationMain extends AbstractJavaFxApplicationSupport {

    @Override
    public void init() throws Exception {
        super.init();
        Font font1 = Font.loadFont(getClass().getResourceAsStream("/font/msyh.ttf"), 12);
        Font font2 = Font.loadFont(getClass().getResourceAsStream("/font/msyhbd.ttf"), 12);
        Font font3 = Font.loadFont(getClass().getResourceAsStream("/font/simfang.ttf"), 12);
        Font font4 = Font.loadFont(getClass().getResourceAsStream("/font/simhei.ttf"), 12);
        Font font5 = Font.loadFont(getClass().getResourceAsStream("/font/simkai.ttf"), 12);
        Font font6 = Font.loadFont(getClass().getResourceAsStream("/font/simsun.ttc"), 12);
        System.out.println(font1.getFamily());
        System.out.println(font2.getFamily());
        System.out.println(font3.getFamily());
        System.out.println(font4.getFamily());
        System.out.println(font5.getFamily());
        System.out.println(font6.getFamily());
    }

    @Override
    public void stop() throws Exception {
//        springContext.close();
    }


    /**
     * The entry point of application.
     *
     * @param args the input arguments
     */
    public static void main(String[] args) {
//        launch(MainWeb.class, MainView.class,new CustomSplash(),args);
        //系统启动时打开CustomSplash欢迎界面，启动后打开LoginView登录界面，指定启动后打开的第一个窗体的样式
        launch(ApplicationMain.class, LoginView.class,new CustomSplash(),new String[]{"--javafx.stage.style=" + StageStyle.TRANSPARENT});
    }

    /**
     * Start.
     * @exception Exception the exception
     */
    @Override
    public void start(Stage primaryStage) throws Exception {

//        primaryStage.setTitle("登录XXXX单机版系统");
//        primaryStage.setResizable(false);
        primaryStage.initStyle(StageStyle.TRANSPARENT);


//        setPrimaryStage(primaryStage);
//        primaryStage.setTitle("XXXX单机版系统");
//        primaryStage.setMaximized(true);
        super.start(primaryStage);
//        primaryStage.show();
    }

}